/*定义一个全局函数*/
//异步函数
let myAsyncAjax =  function(url, data, type,successCallback,errorCallback) {
    let da;
    $.ajax({
        url: url,
        data: type == 'post'?JSON.stringify(data):data,
        type: type == null ? 'get' : 'post',
        dataType: 'json',
        contentType:"application/json",
        async:'false',
        success: successCallback,
        error:errorCallback
    });
    return da;
}

//同步函数
let mySyncAjax = function (url, data, type,successCallback,errorCallback) {
    $.ajax({
        url: url,
        data:  type == 'post'?JSON.stringify(data):data,
        type: type == null ? 'get' : 'post',
        contentType:"application/json",
        dataType: 'json',
        success:successCallback,
        error:errorCallback
    });
}